package data;

import com.EntityName;
import com.google.appengine.api.datastore.Entity;

public class CancellationPolicy extends AbstractData {
	private long id = -1;
	private long hotelId;
	private String title;
	private int Days;
	private int Hours;
	private String reason;
	private boolean Percentcharge;
	private boolean fix;
	private boolean chargeDay;
	private double value;
	private boolean avalible;
	private boolean status;
	
	public CancellationPolicy() {}
 

	public CancellationPolicy( long id) {
		this.id = id;
	}
 
	public long getId() {
		return id;
	}
	
	public void setId(long id) {
		this.id = id;
	}

	public long getHotelId() {
		return hotelId;
	}

	public void setHotelId(long hotelId) {
		this.hotelId = hotelId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int Days() {
		return Days;
	}

	public void setDay(int Days) {
		this.Days = Days;
	}

	public String getDescription() {
		return reason;
	}

	public void setDescription(String reason) {
		this.reason = reason;
	}

	public boolean isPercentcharge() {
		return Percentcharge;
	}

	public void setPercentcharge(boolean percentcharge) {
		Percentcharge = percentcharge;
	}

	public boolean isFix() {
		return fix;
	}

	public void setFix(boolean fix) {
		this.fix = fix;
	}

	public boolean isChargeDay() {
		return chargeDay;
	}

	public void setChargeDay(boolean chargeDay) {
		this.chargeDay = chargeDay;
	}

	public double getValue() {
		return value;
	}

	public void setValue(double value) {
		this.value = value;
	}
	
	public boolean isAvalible() {
		return avalible;
	}

	public void setAvalible(boolean avalible) {
		this.avalible = avalible;
	}

	public boolean isStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	public int getHours() {
		return Hours;
	}

	public void setHours(int hours) {
		this.Hours = hours;
	}

@Override
public Entity getEntity() {

	Entity item;
	if(this.key == null)
		item = new Entity(EntityName.CancellationPolicy);
	else
		item = new Entity(this.key);

	item.setProperty("hotelId", this.hotelId);
	item.setProperty("title", this.title);
	item.setProperty("Days", this.Days);
	item.setProperty("Hours", this.Hours);
	item.setProperty("reason", this.reason);
	item.setProperty("Percentcharge", this.Percentcharge);
	item.setProperty("fix", this.fix);
	item.setProperty("chargeDay", this.chargeDay);
	item.setProperty("value", this.value);
	item.setProperty("avalible", this.avalible);
	item.setProperty("status", this.status);	
	return item;
}

@Override
public void setEntity(Entity entity) {
	this.id = entity.getKey().getId();
	this.hotelId = (Long) entity.getProperty("hotelId");
	this.title = (String) entity.getProperty("title");
	this.Days = ((Long)entity.getProperty("Days")).intValue(); 
	this.Hours = ((Long)entity.getProperty("Hours")).intValue();
	this.reason = (String) entity.getProperty("reason");
	this.Percentcharge = (Boolean) entity.getProperty("Percentcharge");
	this.fix = (Boolean) entity.getProperty("fix");
	this.chargeDay = (Boolean) entity.getProperty("chargeDay");
	this.value = (Double) entity.getProperty("value");
	this.avalible = (Boolean) entity.getProperty("avalible");
	this.status = (Boolean) entity.getProperty("status");

	this.key = entity.getKey();
}

public void LoadData() {
	if (this.id > -1) {
		Entity entity = LoadData(EntityName.CancellationPolicy, this.id);
		setEntity(entity);
	}
}
 
}
